// TCS230颜色传感器获取RGB值'
int tcs230_Getcolor(char data) {
  int frequency = 0;
  switch (data) {
    case 'R': {
      digitalWrite(tcs230_S2,LOW);
      digitalWrite(tcs230_S3,LOW);
      frequency = pulseIn(tcs230_sensorOut, LOW);
      frequency = map(frequency, 25, 72, 255, 0);
      break;
    }
    case 'G': {
      digitalWrite(tcs230_S2,HIGH);
      digitalWrite(tcs230_S3,HIGH);
      frequency = pulseIn(tcs230_sensorOut, LOW);
      frequency = map(frequency, 30, 90, 255, 0);
      break;
    }
    case 'B': {
      digitalWrite(tcs230_S2,LOW);
      digitalWrite(tcs230_S3,HIGH);
      frequency = pulseIn(tcs230_sensorOut, LOW);
      frequency = map(frequency, 25, 70, 255, 0);
      break;
    }
    default:
      return -1;
  }
  if (frequency < 0)
    frequency = 0;
  else if (frequency > 255)
    frequency = 255;
  return frequency;
}